<style>
	tr.sub_row{background:#CCC;}
	tr.sub_row td{padding-left:20px;}
</style>
<div style="padding-bottom:20px;" class="button_section">
	<!--<form>
    	<input type="text"><input type="submit" value="search">
    </form>-->
       <div class="left width65p componentheading"><?php echo $page_title;?></div>
          <a class="button" href="<?php echo site_url('users/add')?>">Add New User</a>
        <div class="clear"></div>
</div>
<div class="box-header">Users List</div>
<table width="100%">
	<thead>
      <tr>
            <th width="5%" height="32">Id</th>
            <th width="40%" height="32">Name</th>
            <th width="20%">Username</th>
            <th width="20%">Email</th>
            <th width="5%">Status</th>
            <th width="10%">Action</th>
      </tr>
   </thead>
   <tbody>
      <?php if(count($users) > 0): ?>
      <?php foreach($users as $user) : ?>
            <tr>
            	<td><?php echo $user->id;?></td>
                <td>
	                <?php echo $user->first_name." ".$user->last_name;?>
                </td>
                <td>
                	<?php echo $user->username;?>
                </td>
                <td>
                    <a href="mailto:<?php echo $user->email;?>"><?php echo $user->email;?></a>
                </td>
                <td><?php echo $user->status;?></td>
                <td><a href="<?php echo action_link('edit', $user->id)?>">Edit</a>
				<?php if(is_super_admin()) : ?>
                &nbsp;|&nbsp;<a href="<?php echo action_link('delete_user', $user->id);?>" class="delete_link">Delete</a></td>
                <?php endif; ?>
            </tr>
            
      <?php endforeach; ?>
      <?php else: ?>
      	<tr>
        	<td colspan="3">
      		<div class="error_message">
            	No Users have been added.
            </div>
            </td>
        </tr>
      <?php endif; ?>
    </tbody>  
</table>
<div id="pagination">
	<?php echo $this->pagination->create_links(); ?>
</div>
